<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <style>
     *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        ul{
            overflow: hidden;
            margin: 20px auto;
            height: 30px;
            width: 485px;
        }
        li{
            float: left;
            width:120px;
            text-align: center;
            height: 30px;
            line-height: 30px;
            cursor: pointer;
        }
        div{
            width: 800px;
            height: 500px;
            text-align: center;
            line-height: 500px;
            border:2px solid red;
            display: none;
            margin: auto;
            background-image: url(.//01.jpg);
            background-size: 801px;
            color: red;
        }
        li:hover{
            background: saddlebrown;
        }
        li.current{
            color:black;
        }
        div.current{
            display: block;
        }
        img{
            width: 800px;
            height: 500px;
        }
    </style>
    <body>
        <ul>
            <li class="current">照片1</li>
            <li>照片2</li>
            <li>照片3</li>
            <li>照片4</li>
        </ul>
        <section>
            <div class="current"><img src="images/4.jpg" alt=""></div>
            <div><img src="images/1.jpg" alt=""></div>
            <div><img src="images/2.jpg" alt=""></div>
            <div><img src="images/3.jpg" alt=""></div>
        </section>
        <script>
            var tags=document.getElementsByTagName('li');
            var boxs=document.getElementsByTagName('div');
            for(var i=0;i<tags.length;i++){
                tags[i].index=i;
                tags[i].onclick=function(){
                    for(var j=0;j<tags.length;j++){
                        tags[j].className=''
                        boxs[j].className=''
                    }
                    this.className='current';
                    var n=this.index;
                    boxs[n].className='current'
                }
            }
        </script>
    </body>
</html>